package bdqn.dao.impl;

import bdqn.dao.BaseDao;
import bdqn.dao.MeetingRoomDao;
import bdqn.entity.MeetingRoom;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class MeetingRoomDaoImpl extends BaseDao implements MeetingRoomDao {
    @Override
    public List<MeetingRoom> meetList() {
        List<MeetingRoom> meetingRoomList = new ArrayList<MeetingRoom>();
        conn = getConn();
        try {
            pstm = conn.prepareStatement("SELECT * FROM meetingroom");
            rs = pstm.executeQuery();
            while (rs.next()) {
                MeetingRoom meetingRoom = new MeetingRoom();
                meetingRoom.setId(rs.getInt("id"));
                meetingRoom.setMeeting_name(rs.getString("meeting_name"));
                meetingRoom.setMeeting_order(rs.getString("meeting_order"));
                meetingRoom.setAdvance_name(rs.getString("advance_name"));
                meetingRoomList.add(meetingRoom);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            close(rs,pstm,conn);
        }

        return meetingRoomList;
    }

    @Override
    public int meetingAdd(MeetingRoom meetingRoom) {
        return 0;
    }
}
